<template>
  <div class="register_login_warp">
    <div class="login-warp">
      <div class="warp-left"></div>
      <div class="warp-right">
        <img src="../../assets/app_logo.png" alt="" class="app_logo flex">
        <el-form :model="userInfo" status-icon :rules="rules" ref="ruleForm" label-width="60px" class="demo-ruleForm">
          <el-form-item label="账号:" prop="account">
            <el-input v-model="userInfo.account" placeholder="请输入账号" class="value"></el-input>
          </el-form-item>
          <el-form-item label="密码:" prop="pwd">
            <el-input type="password" v-model="userInfo.pwd" autocomplete="off" class="value" placeholder="请输入密码"></el-input>
          </el-form-item>
        </el-form>
        <div class="flex">
          <el-button @click="cancel">取消</el-button>
          <el-button type="primary" @click="userLogin"> 登录/注册</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
     userInfo: {
       account: 'admin',
       pwd: '123456'
     },
      rules: {
        account: [
          { required: true, message: '请输入账号', trigger: 'blur' },
        ],
        pwd: [
          { required: true, message: '请输入密码', trigger: 'blur' },
        ],

      }
    }
  },
  mounted() {
  },
  methods: {
    userLogin() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          this.$emit('userLogin')
        }
      })


    },
    cancel() {
      this.$emit('cancel')
    }
  }
}

</script>

<style lang="scss" scoped>
.register_login_warp{
  z-index: 9999999;
  position: fixed;
  width: 860px;
  height: 500px;
  border-radius: 6px;
  background-color: rgba(234,244,255,1);
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  .login-warp{
    display: flex;
    padding: 20px;
    height: 100%;
    .warp-left{
      flex: 5;
    }
    .warp-right{
      flex: 3;
      border: 2px solid #fff;
      height: 100%;
      margin-left: 20px;
      border-radius: 6px;
      .app_logo{
        width: 100px;
        height: 100px;
        margin: 40px auto;
      }
      .value{
        width: 210px;
      }
    }
  }
}
</style>
